/*
 * Copyright (c) [2012] - [2017] Red Hat, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Red Hat, Inc. - initial API and implementation
 */
package com.codenvy.selenium.pageobject;

import com.codenvy.selenium.core.entrance.OnpremEntranceImpl;
import com.codenvy.selenium.pageobject.site.LoginAndCreateOnpremAccountPage;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.core.client.TestProfileServiceClient;
import org.eclipse.che.selenium.core.entrance.Entrance;
import org.eclipse.che.selenium.core.pageobject.PageObjectsInjector;
import org.eclipse.che.selenium.core.provider.TestDashboardUrlProvider;
import org.eclipse.che.selenium.pageobject.Loader;

/** @author Dmytro Nochevnov */
@Singleton
public class PageObjectsInjectorImpl extends PageObjectsInjector {

  @Inject private TestProfileServiceClient testProfileServiceClient;
  @Inject private TestDashboardUrlProvider dashboardUrlProvider;

  @Override
  public Map<Class<?>, Object> getDependenciesWithWebdriver(SeleniumWebDriver seleniumWebDriver) {
    Map<Class<?>, Object> dependencies = new HashMap<>();
    dependencies.put(
        Entrance.class,
        new OnpremEntranceImpl(
            seleniumWebDriver,
            new LoginAndCreateOnpremAccountPage(
                seleniumWebDriver, new Loader(seleniumWebDriver), dashboardUrlProvider),
            testProfileServiceClient));

    return dependencies;
  }
}
